package com.project.account.controller;

import com.project.account.service.AccountService;
import com.project.common.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: seata-at
 * @description: 账户信息
 * @author: mml
 * @create: 2023/12/19
 */
@RestController
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @PutMapping("/deduct")
    public RespResult deduct(String account, Double money) {
        boolean flag = accountService.deductAccount(account, money);
        if (flag) {
            return RespResult.success("扣款成功");
        }
        return RespResult.error("扣款失败");
    }
}
